package com.hp.demo.vteam.bean;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.users.User;
import com.hp.demo.vteam.base.annotation.AutoLoad;
import com.hp.demo.vteam.base.annotation.PropertyExpr;
import com.hp.demo.vteam.base.annotation.PropertyRender;
import com.hp.demo.vteam.base.annotation.Render;

@AutoLoad(attrs={"inforKind"})
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Information {
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    @PropertyExpr(property="id")
    private Key id;

    @Persistent
    private String name;
        
    @Persistent
    private String desc;
    
    @Persistent
    private String txt;
    
    @Persistent
    @PropertyExpr(property={"id","name"})
    private InforKind inforKind;
    
    @Persistent
    private User addedBy;
    
	@Persistent
	@PropertyRender(parser=Render.dateFormat)
    private Date addedTime;
	
	public Information(Key id)
	{
		this.id = id;
	}
	
    public Information(String name,String txt,String desc, User addedBy, Date addedTime,InforKind inforKind) {
    	this.addedBy = addedBy;
        this.name = name;
        this.txt=txt;
        this.desc = desc;
        this.addedTime = addedTime;
        this.inforKind = inforKind;
    }

    public Key getId() {
        return id;
    }
    
	public void setId(Key id) {
		this.id = id;
	}

	public User getAddedBy() {
		return addedBy;
	}

	public void setAddedBy(User addedBy) {
		this.addedBy = addedBy;
	}

	public String getName() {
		return name;
	}
	
	public String getTxt(){
		return txt;
	}

    public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public void setTxt(String txt){
		this.txt=txt;
	}

	public Date getAddedTime() {
		return addedTime;
	}

	public void setAddedTime(Date addedTime) {
		this.addedTime = addedTime;
	}

	public InforKind getInforKind() {
		return inforKind;
	}

	public void setInforKind(InforKind inforKind) {
		this.inforKind = inforKind;
	}
}
